package com.arges.web.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.springframework.stereotype.Repository;

import com.arges.web.domain.pojo.Treat;

/**
 * 患者诊断治疗dao
 *
 * @author zxj
 */
@Repository
public class TreatDao extends GenericDao<Treat, Long>
{

	public void deletePatByIds(Long[] deleteId)
	{
		StringBuffer hql = new StringBuffer();
		hql.append("delete from Treat where id in (");
		for (int i = 0; i < deleteId.length; i++)
		{
			hql.append(deleteId[i] + ",");
		}
		hql.deleteCharAt(hql.length() - 1).append(")");
		getSession().createQuery(hql.toString()).executeUpdate();
	}

	public List<Treat> getTreatIsTreat(Class<Treat> class1, Criterion condiition)
	{
		Criteria criteria = getSession().createCriteria(class1);
		if (null != condiition)
		{
			criteria.add(condiition);
		}
		List<Treat> list = criteria.list();

		return list;
	}

}
